package com.team.utils;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

/**
 * 流工具类
 * 
 * @author kungfupeng
 *
 */
public class StreamUtil {
	public static String read(InputStream is) {
		try {
			ByteArrayOutputStream baos = new ByteArrayOutputStream();
			int len = 0;
			byte[] buffer = new byte[512];
			while ((len = is.read(buffer)) != -1) {
				baos.write(buffer, 0, len);
			}
			return new String(baos.toByteArray(), 0, baos.size(), "utf-8");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "";
	}
}
